package de.gameduell.framework.game.billard.view {
	import de.gameduell.framework.debug.Debug;
	import de.gameduell.framework.game.billard.controller.PhysicController;
	import de.gameduell.framework.game.billard.model.Ball;
	import de.gameduell.framework.gui.wrapper.SpriteWrapper;
	
	import flash.display.Sprite;
	import flash.events.Event;	

	/**
	 * @author cbra
	 */
	public class GhostBallView extends SpriteWrapper{
		private var ball:Ball;
		private var physicController:PhysicController;
		private var _ballMask:Sprite;

		public function GhostBallView(aContent:Sprite,aPhysicController:PhysicController) {
			super(aContent.getChildByName("ghostBall") as Sprite);
			_ballMask = aContent.getChildByName("ghostBallPath_mask") as Sprite;
			physicController = aPhysicController;
			ball = physicController.ghostBall;	
			sprite.alpha = 1;
		}
		
		override public function set x(aX:Number):void{
			super.x = aX;
			_ballMask.x = aX;
		}

		override public function set y(aY:Number):void{
			super.y = aY;
			_ballMask.y = aY;
		}
			
		public function get ballMask():Sprite{
			return _ballMask;
		}
		
		public function update(event:Event = null):void{				
			sprite.x = ball.position.x;
			sprite.y = ball.position.y;
			_ballMask.x = ball.position.x;
			_ballMask.y = ball.position.y;
			Debug.trace("GhostBallView "+_ballMask.x);
		}
			
	}
}
